package cn.wolfcode.wolf2w.redis.service;

import cn.wolfcode.wolf2w.domain.UserInfo;

import java.util.List;

/**
 * Created by 甘静斌 on 2020-08-07 20:15
 */
public interface IUserInfoRedisService {


    /**
     * 根据redis特性,把验证码(code)缓存到redis上
     * 方便获取
     * phone:code
     * @param phone
     * @param code
     */
    void setVerifyCode(String phone, String code);

    /**
     * 从redis上获取code,
     * phone:code
     * @param phone
     * @return
     */
    String getVerifyCode(String phone);

    /**
     * 根据对象获取token,
     * @param user
     * @return
     */
    String getToken(UserInfo user);


    /**
     * token相当于令牌
     * 登陆成功后的info.html页面,
     * 并把token传回浏览器,
     * @param token
     * @return
     */
    UserInfo getUserByToken(String token);


}
